ds_list_create

语法:

ds_list_create();


返回: Real(实数)


描述

这个方法将新建一个列表数据结构,并返回这个列表的索引值这个索引值应当存储到变量中,以便与其它函数来调用这个列表。Note that if you try and access a value in the list before it has been populated - i.e. the list is "empty" - then the return value may be 0 since internally the first few entries in the list are set when created to minimize performance issues when initially adding items to the list (although the ds_list_size() function will still return 0 on a newly created list). If you wish to ensure that the list is "truly" empty on create, then you should call ds_list_clear() after creating the list, which will then mean that any values returned for unpopulated list slots will be undefined.

重要!创建数据结构时,用于标识它的索引值是从0开始的整数值。这意味着不同类型的数据结构可以具有相同索引值,所以如果有疑问你应该使用ds_exists访问它们之前的功能。Also note that indexes are re-used, so a destroyed data structure index value may be used by a newly created one afterwards.


例如:

list = ds_list_create();

这行代码会创建一个新的列表,并将这个列表的索引值赋予名为“list”的变量。


上一页: DS Lists
下一页: ds_list_destroy
© Copyright YoYo Games Ltd. 2018 All Rights Reserved